package a.codetop;


public class _7递增子序列_最长长度 {

    public int lengthOfLIS(int[] nums) {
        int[] dp = new int[nums.length];

        dp[0]=1;
        for (int i = 1; i < nums.length; i++) {
            int max = -99999;
            //找左侧最大
            for (int l = 0; l <= i-1 ; l++) {
                if(nums[i]>nums[l]) {
                    max = Math.max(dp[l], max);
                }
            }
            //问长度1,问最大值[ci]
            dp[i] = max==-99999?1:max+1;
        }

        //再遍历
        int max = -99999;
        for (int i = 0; i < dp.length; i++) max = Math.max(dp[i],max);
        return max;
    }
}
